// https://i.maoyan.com/api/mmdb/movie/v3/list/hot.json?ct=%E5%8C%97%E4%BA%AC&ci=1&channelId=4

const http = require('http')
const https = require('https')
const url = require('url')
http.createServer((req, res) => {
    const urlObj = url.parse(req.url, true)
    console.log(urlObj, 'obj')
   getData(res)
}).listen(9090, () => console.log('ok'))

function getData (response) {
    let data = ''
    https.get('https://i.maoyan.com/api/mmdb/movie/v3/list/hot.json?ct=%E5%8C%97%E4%BA%AC&ci=1&channelId=4', res => {
        res.on('data', chunk => {
            data += chunk
        })     
        res.on('end', () => {
            // console.log(data, 'data')
        }) 
        response.end(data)
    })
}